import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class Interface extends JFrame implements ActionListener{

        public Interface(){
                
        		setLayout(new BorderLayout());
        		
        		// Creates the menu bar
        		JMenuBar menuBar = createNewMenu();
        		setJMenuBar(menuBar);
    
                
	// Creates the Layered Pane
        		InterfaceSelector testPane = new InterfaceSelector();
                add(testPane, BorderLayout.CENTER);
                //Frame initialization
                pack();
                setMinimumSize(new Dimension(700 ,400));
                setPreferredSize(new Dimension(800 ,600));
                setLocationRelativeTo(null);
                setSize(1024, 600);
                setExtendedState(MAXIMIZED_BOTH);
                setResizable(true);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                setTitle("Audio Immerse");
        		java.net.URL newurl = this.getClass().getResource("pictures/logo.png");
        		setIconImage(new ImageIcon(newurl).getImage());
        		
        		
                setVisible(true);
                
        }
        
        JMenuBar createNewMenu(){
        	
        	JMenuBar tempBar = new JMenuBar();
        	// Create a menus
    		JMenu File = new JMenu("File");
    		JMenu Help = new JMenu("Help");
    		tempBar.add(File);
    		tempBar.add(Help);
    		// Create a menu item
    		JMenuItem item = new JMenuItem("Open");
    		JMenuItem item1 = new JMenuItem("Exit");
    		item1.addActionListener(this);
    		item1.setActionCommand("Exit");
    		JMenuItem item2 = new JMenuItem("About");
    		item2.addActionListener(this);
    		item2.setActionCommand("About");
    		JMenuItem item3 = new JMenuItem("Help");
    		item3.addActionListener(this);
    		item3.setActionCommand("Help");
    		File.add(item);
    		File.add(item1);
    		Help.add(item2);
    		Help.add(item3);
    		// Install the menu bar in the frame
        	return tempBar;
        	
        }

		public void actionPerformed(ActionEvent arg0) {
			if(arg0.getActionCommand().equals("Exit")){
				System.out.println("closing");
				System.exit(0);
			}
			if(arg0.getActionCommand().equals("About")){
				System.out.println("showing about");
				AboutFrame showAbout = new AboutFrame();
			}
			if(arg0.getActionCommand().equals("Help")){
				System.out.println("help");
				HelpFrame showHelp = new HelpFrame();
			}
		}
        
        
}
